home *** CD-ROM | disk | FTP | other *** search
/ Enter 2001 April / EnterCD4.iso / Update / SQL Server SP3 / sql70sp3i.exe / X86 / BINN / res / 1033 / sqlmmc.rll / HTML / JSCOMMON.JS < prev    next >
Encoding:
Text File  |  1999-04-12  |  4.3 KB  |  166 lines

  1. function DoNothing()
  2. {
  3.     // Stub
  4. }
  5.  
  6. //****************************        
  7. // CLICK EVENT HELPER FUNCTION
  8. //****************************
  9.  
  10. function SymbolClickHandler(theIndex)
  11. {
  12.     // Determine what type of action to take
  13.     // based on value in gaiBtnActionType array
  14.     
  15.     switch (gaiBtnActionType[theIndex])
  16.     {
  17.         case 0:     // MMC_TASK_ACTION_ID:
  18.             ExecuteCommandID (gaszBtnActionClsid[theIndex], gaiBtnActionID[theIndex], 0);
  19.             break;
  20.  
  21.         case 1:     // MMC_TASK_ACTION_LINK:
  22.             window.event.returnValue = true;
  23.             break;
  24.  
  25.         case 2:     // MMC_TASK_ACTION_SCRIPT:
  26.             // Determine whether the language is (JSCRIPT | JAVASCRIPT) or (VBSCRIPT | VBS)
  27.             // Convert toUpperCase
  28.             var szLanguage = gaszBtnActionScriptLanguage[theIndex].toUpperCase();
  29.                         
  30.             switch (szLanguage)
  31.             {
  32.                 case "JSCRIPT":
  33.                 case "JAVASCRIPT":
  34.                     // Pass a script string to the JSObject to be evaluated and executed
  35.                     // through the eval method (this can be a semi-colon delimited complex expression)
  36.                     eval (gaszBtnActionScript[theIndex]);
  37.                     break;
  38.  
  39.                 case "VBSCRIPT":
  40.                 case "VBS":
  41.                     // Use the window.execScript method to execute a simple or complex VBScript expression
  42.                     window.execScript (gaszBtnActionScript[theIndex], szLanguage);
  43.                     break;
  44.  
  45.                 default:
  46.                     alert ("Unrecognized scripting language.");
  47.                     break;
  48.             }
  49.             break;
  50.  
  51.         default:
  52.             alert ("Unrecognized task.");
  53.             break;
  54.     }
  55. }
  56.  
  57. //***************************************************
  58. // CIC TASK NOTIFY HELPER FUNCTION (ExecuteCommandID)
  59. //***************************************************
  60.  
  61. function ExecuteCommandID(szClsid, arg, param)
  62. {
  63.    MMCCtrl.TaskNotify (szClsid, arg, param);
  64. }
  65.  
  66. //***********************************
  67. // EOT & FONT-FAMILY HELPER FUNCTIONS
  68. //***********************************
  69.  
  70. function IsUniqueEOT(szURLtoEOT)
  71. {
  72.     // Get the length of the test array
  73.     var iLength = gaszURLtoEOTUnique.length;
  74.  
  75.     // If the length is empty, return true
  76.     // since the EOT *must* be unique
  77.     if (iLength == 0) {
  78.         return true;
  79.     }
  80.     
  81.     // Compare with each existing entry in the array
  82.     for (var i = 0; i < iLength; i++) {
  83.         if (gaszURLtoEOTUnique[i] == szURLtoEOT) {
  84.             // Found a duplicate
  85.             return false;
  86.         }
  87.     }
  88.     
  89.     // If we made it this far, the EOT is unique
  90.     return true;
  91. }
  92.  
  93. function AddUniqueEOT(szEOT, szFontFamilyName)
  94. {
  95.     // Use the length of the EOT array to get the
  96.     // index for the next element to be added
  97.     var iNextIndex = gaszURLtoEOTUnique.length;
  98.     gaszURLtoEOTUnique[iNextIndex] = szEOT;
  99.     gaszFontFamilyNameUnique[iNextIndex] = szFontFamilyName;
  100. }
  101.  
  102. //***************
  103. //COLOR FUNCTIONS
  104. //***************
  105.  
  106. function SynchTooltipColorsToSystem()
  107. {
  108.     tblTooltip.style.backgroundColor = "infobackground";
  109.     tblTooltip.style.color = "infotext";
  110.     divTooltipPointer.style.color = "buttonshadow";
  111.     
  112.     // Show a one-pixel border around the divTooltip
  113.     divTooltip.style.borderWidth = 1;
  114. }
  115.  
  116. //*****************
  117. //UTILITY FUNCTIONS
  118. //*****************
  119.  
  120. function GetSmallerDimension()
  121. {
  122.     //Purpose: Returns the smaller of clientHeight or clientWidth
  123.     var cw = document.body.clientWidth;
  124.     var ch = document.body.clientHeight;
  125.     
  126.     // Get smaller of clientWidth or clientHeight
  127.     if (cw <= ch) {
  128.         return cw;
  129.     }
  130.     else {
  131.         return ch;
  132.     }
  133. }
  134.  
  135. function GetElementIndex(ElementID)
  136. {
  137.     // Purpose: Given an Element ID formatted as follows:
  138.     //         "divCaption_12"
  139.     // returns the numeric portion after the underscore character;
  140.     // returns -1 if delimiter not found.
  141.     
  142.     var iDelimitLoc = ElementID.indexOf("_");
  143.  
  144.     if (iDelimitLoc == -1) {
  145.         // Return -1 if delimiter not found (which shouldn't happen)
  146.         return iDelimitLoc;
  147.     }
  148.     else {
  149.         var theIndex = ElementID.substring(iDelimitLoc + 1, ElementID.length);
  150.         // TODO: Confirm that theIndex is numeric and does not contain illegal characters
  151.         return theIndex;
  152.     }
  153. }
  154.  
  155. function GetPixelSize(szTheSize)
  156. {
  157.     // Purpose: Given an Element.style.fontSize formatted as follows:
  158.     //          "72px"
  159.     // returns the parsed numeric portion, discarding the "px" string at the end;
  160.     // Assumes that szTheSize is properly formatted, and that the Object Model identifier
  161.     // for pixel size always appears at the end of the string.
  162.     
  163.     // TODO: Absolutely no error checking here (or in calling function)
  164.     return parseInt(szTheSize);
  165. }
  166.